<?php
function __sortLink($key, $name, $params = array()) {
	$view = system_view::getControllerActionViewInstance();
	$request = system_controller_front::getInstance()->getRequest();
	$router = system_controller_front::getInstance()->getRouter()->getCurrentRoute()->getRouteIndex();
	$query = $request->getQuery();
	$_sort = intval($request->getQuery('sort'));
	$_order = $request->getQuery('order') ? strtolower($request->getQuery('order')) : '';
	$s = '<a' . ($_order == $key ? ' class="s' . $_sort . '"' : '') . ' href="';
	$s .= $view->url($router, $params, array_merge($query, array('order' => $key, 'sort' => !$_sort)));
	$s .= '">' . $view->language($name) . '</a>';
	return $s;
}
?>